package trial;

import global.AttrType;
import global.Convert;
import global.PageId;
import global.RID;
import global.SystemDefs;
import heap.HFPage;
import heap.Heapfile;
import heap.Tuple;

public class Trial1
{	
	public static void main(String[] args) throws Exception
	{
		Heapfile hf = null;
		new SystemDefs("DataBase", 5000, 5000, "Clock");
		hf = new Heapfile("File");
		String key ="kim";
		HFPage h= new HFPage();
		
		byte[] array = new byte[key.length() + 2];
		Convert.setStrValue(key, 0, array);
		RID rid1=hf.insertRecord(array);
		
		System.out.println("RID of the 1st record :\nID : "+rid1.pageNo+"\nSlotNumber : "+rid1.slotNo);
		String key2 ="John Aziz Anis";
		array = new byte[key2.length() + 2];
		Convert.setStrValue(key2, 0, array);
		RID rid2=hf.insertRecord(array);
		System.out.println("RID of the 2nd record :\nID : "+rid2.pageNo+"\nSlotNumber : "+rid2.slotNo);
		hf.deleteRecord(rid1);
		System.out.println("Deleting the 1st record");
		Tuple tup=hf.getRecord(rid2);
		System.out.println(Convert.getStrValue(0, tup.getTupleByteArray(),
				tup.getTupleByteArray().length));
//		rid1.slotNo=2;
//		tup=hf.getRecord(rid1);
//		System.out.println(Convert.getStrValue(0, tup.getTupleByteArray(),
//				tup.getTupleByteArray().length));
		
	}
}
